package com.example.bigdata.hadoop

import org.apache.hadoop.conf.Configuration
import org.apache.hadoop.fs.{FileSystem, Path}

object hdfsProtection {
    def main(args: Array[String]): Unit = {
        val confPath = "conf/szDcTest/"
        val coreFile = confPath + "core-site.xml"
        val hdfsFile = confPath + "hdfs-site.xml"
        val conf  = new Configuration
//        val dfsfile = "/tmp/ae001/part-00000.3"
        val dfsfile = "/tmp/ae001/part-00000.3"
        val delPath = new Path(dfsfile)
        val x = conf.get("fs.defaultFS")
        conf.addResource(new Path(coreFile))
        conf.addResource(new Path(hdfsFile))
        val hdfs = FileSystem.get(conf)
        val del = hdfs.delete(delPath, true)
        println(del)
    }
}
